package com.magic.gre.ui.activity;

import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;

import com.magic.gre.R;
import com.magic.gre.base.activity.BaseMVPActivity;
import com.magic.gre.mvp.contract.SplashContract;
import com.magic.gre.mvp.presenter.SplashPresenterImpl;

/**
 * Author: Lmoumou
 * Date: 2019-01-11 16:15
 * 文件名: SplashActivity
 * 描述:
 */
public class SplashActivity extends BaseMVPActivity<SplashPresenterImpl> implements SplashContract.View {

    private Handler handler = new Handler();

    @Override
    protected int getLayoutId() {
        return R.layout.activity_splash;
    }

    @Override
    protected boolean isImmerse() {
        return true;
    }

    @Override
    protected SplashPresenterImpl creatPresenter() {
        return new SplashPresenterImpl(this);
    }

    @Override
    protected void netOverride() {

    }

    @Override
    protected void initView(@Nullable Bundle savedInstanceState) {
        super.initView(savedInstanceState);
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                MainActivity.startThis(SplashActivity.this);
//                GuideActivity.startThis(SplashActivity.this);
//                TestActivity.startThis(SplashActivity.this);
                finish();
            }
        }, 1000);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        handler.removeCallbacksAndMessages(null);
    }
}
